package com.audiocn.manager;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import com.audiocn.dc.BaseDC;
import com.audiocn.poster.Application;

public abstract class BaseManager extends Handler{
	
	/**
	 * initDC中使用
	 */
	Context context;
	
	public static final int MSG_ENTER_IN_END = 1000;
	public static final int MSG_ENTER_OUT_END = 1001;
	public static final int MSG_BACK_IN_END = 1002;
	public static final int MSG_BACK_OUT_END = 1003;
	public static final int MSG_BACK_SELF_END = 1004;
	public static final int MSG_ENTER_SELF_END = 1005;
	
	public BaseDC lastDC = null;
	
	public boolean isLeave = false;
	
	public BaseManager(Context c){
		this.context=c;
	}
	/**
	 * 返回当前正在显示的DC,非baseDC则返回null
	 * @author wang wei
	 */
	public BaseDC getNowShownDC(){
		return Application.dcEngine.getNowDC();
	}
	public abstract void handleMessage(Message msg);
	/**
	 * 如果DC中的点击事件,需要更改数据等,则直接调用此方法,应在子类中重写
	 * @author wang wei
	 */
	public void onClicked(int id){
		
	}
	
	public BaseDC getMainDC() {
		return null;
	}
	
	public BaseDC getLastDC() {
		return lastDC;
	}
	public abstract boolean back();
	public void enterSubDC(BaseDC dc) {
		if(Application.dcEngine.notAnimition()){
			Application.dcEngine.showDC(dc, 1);
		}
	}
	public void backSubDC(BaseDC dc) {
		if(Application.dcEngine.notAnimition()){
			Application.dcEngine.showDC(dc, 2);
		}
	}
}
